<html>
<head><meta charset="utf-8"><title>Are all type errors handled before mir_build · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html">Are all type errors handled before mir_build</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214470995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214470995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214470995">(Oct 25 2020 at 05:48)</a>:</h4>
<p>I'm working on <a href="https://github.com/rust-lang/rust/issues/77993">https://github.com/rust-lang/rust/issues/77993</a>, and am wondering if we ever get to mir_build if we see a TyKind::Error?</p>



<a name="214471412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471412">(Oct 25 2020 at 05:59)</a>:</h4>
<p>item-bodies checking goes through MIR IIRC</p>



<a name="214471422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471422">(Oct 25 2020 at 05:59)</a>:</h4>
<p>I'm not familiar with that, can u elaborate?</p>



<a name="214471431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471431">(Oct 25 2020 at 05:59)</a>:</h4>
<p>(deleted)</p>



<a name="214471432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471432">(Oct 25 2020 at 05:59)</a>:</h4>
<p>And this is part of item-bodies checking because the signature of <code>-&gt; impl Trait</code> functions is affected by their body</p>



<a name="214471442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471442">(Oct 25 2020 at 06:00)</a>:</h4>
<p>(deleted)</p>



<a name="214471443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471443">(Oct 25 2020 at 06:00)</a>:</h4>
<p>(deleted)</p>



<a name="214471507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471507">(Oct 25 2020 at 06:00)</a>:</h4>
<p>Item-bodies checking is just 'type checking the bodies of items', which includes functions and constant initializers</p>



<a name="214471515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471515">(Oct 25 2020 at 06:01)</a>:</h4>
<p>And I think also traits</p>



<a name="214471535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471535">(Oct 25 2020 at 06:01)</a>:</h4>
<p>Tho will we ever get to that stage if a prev stage (trait_selection or typeck) have type errors? I'd guess no</p>



<a name="214471581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471581">(Oct 25 2020 at 06:02)</a>:</h4>
<p>Typeck <em>is</em> item-bodies checking</p>



<a name="214471592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471592">(Oct 25 2020 at 06:02)</a>:</h4>
<p>Well, among other things</p>



<a name="214471760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471760">(Oct 25 2020 at 06:06)</a>:</h4>
<p>Isn't typeck mostly HIR that after writeback goes to rustc_mir_build?</p>



<a name="214471786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471786">(Oct 25 2020 at 06:07)</a>:</h4>
<p>I don't know what write back is</p>



<a name="214471794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471794">(Oct 25 2020 at 06:07)</a>:</h4>
<p>Also FWIW it looks like this issue has a partial fix already: <a href="https://github.com/sexxi-goose/rust/pull/26">https://github.com/sexxi-goose/rust/pull/26</a></p>



<a name="214471799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471799">(Oct 25 2020 at 06:07)</a>:</h4>
<p>That's the end stage of typeck that creates the Typeck Results</p>



<a name="214471803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214471803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214471803">(Oct 25 2020 at 06:07)</a>:</h4>
<p>Yeah, I'm working with her(roxelo) on this</p>



<a name="214472867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214472867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214472867">(Oct 25 2020 at 06:31)</a>:</h4>
<p>This bit is most of what I know about typeck: <a href="https://github.com/sexxi-goose/rust/blob/master/src/librustdoc/core.rs#L393-L423">https://github.com/sexxi-goose/rust/blob/master/src/librustdoc/core.rs#L393-L423</a></p>



<a name="214476614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Are%20all%20type%20errors%20handled%20before%20mir_build/near/214476614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Are.20all.20type.20errors.20handled.20before.20mir_build.html#214476614">(Oct 25 2020 at 08:08)</a>:</h4>
<p>Note that the compiler doesn't really have stages. So <code>mir_built</code> will invoke everything it needs to work, including typeck. Also arbitrary places could invoke type check of other items if they refer to said other items</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>